home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zoom 2
/
Zoom - Release 2 (1996)(Active Software)[!].iso
/
texts
/
dosman121
/
man
/
if
< prev
next >
Wrap
Text File
|
1995-05-05
|
5KB
|
137 lines
IF(V1.3 in C:) (2.x/3.x Internal)
NAME
IF - Add intelligent branching to scripts.
SYNOPSIS
IF NOT WARN ERROR FAIL string1EQstring2
string1GTstring2 string1GEstring2 VAL EXISTS
DESCRIPTION
If the condition tested by IF evaluates to TRUE, then
the commands immediately following the IF, up to the
following ELSE or ENDIF, are executed. If the condition
tested by IF evaluates to FALSE, it moves the execution
of the file ahead to the command following the next ELSE
command (if there is one), or to ENDIF, if there is no
intervening ELSE.
The ELSE command (if used) must show up between the
IF and ENDIF statements.
CONDITIONS
Each of the following will evaluate to true or false:
WARN
This will be true if the return code value set by the
last command is greater than or equal to 5.
ERROR
This will be true if the return code value set by the
last command is greater than or equal to 10.
FAIL
This will be true if the return code value set by the
last command is greater than or equal to 20. Note that
you will have to use a Failat command to raise the
default fail limit from 10 to above 20 if you wish to use
this test.
string1EQstring2
This takes two strings, and will be true if both
arguments are the same (i.e., EQUAL). The default is a
string comparison, but see VAL, below. The comparison is
not case sensitive. The test can be reversed by using the
NOT keyword with it. It can be a numberic comparison if
you utilize the VAR keyword. Strings 1 & 2 are normally
text, if there are spaces in the strings then quotes must
be placed around it.
Environmental variables may also substitute a string
by using a dollar sign ($) directly before the the
variable name (so, $Amount represents the variable
Amount).
string1GEstring2
Takes two arguments. This will be true if the first
argument is Greater than or Equal to the second argument.
This may be combined with NOT (see below) to perform a LT
(less than) test. The default comparison is a string
compare, use VAL to compare numbers. Strings 1 & 2 are
normally text, if there are spaces in the strings then
quotes must be placed around it.
Environmental variables may also substitute a string
by using a dollar sign ($) directly before the the
variable name (so, $Amount represents the variable
Amount).
string1GTstring2
Takes two arguments. This will be true if the first
argument is Greater than the second. This may be
combined with NOT (see below) to construct a LE (less
than or equal to) test. The default comparison is a
string compare, but use VAL to compare numbers. Case
sensitivity does not matter. Strings 1 & 2 are normally
text, if there are spaces in the strings then quotes must
be placed around it.
Environmental variables may also substitute a string
by using a dollar sign ($) directly before the the
variable name (so, $Amount represents the variable
Amount).
EXISTS
This takes one argument, which should be a device,
file or directory. This will be TRUE if the device, file
or directory exists.
MODIFIERS
The following options to IF modify the meaning of the
above tests:
NOT
Inverts the sense of the test. This is always used
in combination with another keyword. As an example, the
line: "If NOT EQ" will be TRUE if the EQ is false. This
modifier combines with any of the others.
VAL
This affects the type of compare done by the EQ GT
and GE keywords. By default, the comparison is a string
compare. However, if you specify this keyword, the
comparison performed is numeric.
If you don't use the VAL keyword then the string will
be compared one numeral at a time from left to right.
For instance the string 22 will be shown to be greater
than 011 since the first character is 0 in the second
string which is smaller than 2 in the first.
OTHER
2.x/3.x contains this command is internal. The only
other difference between the 1.3 & 2.x/3.x version is
that the 2.x/3.x version can be executed directly from
the command line, while the diskbased version cannot.
EXAMPLE
1. If you are running Workbench 3.0, the CLI will say
"An Execellent decsion. If you are running any other OS
then you get a message saying "Why not?"
IF EXISTS Workbench3.0
Echo "An excellent decision!"
ELSE
Echo "Why not?"
ENDIF
SEE ALSO
Execute Assign